package com.design.pattern.command.projection4;

import java.util.List;

/**
 * 命令
 */
public class Command {
    /**
     * 命令内容
     */
    private String content;
    private List<CommandExecutor> executors;

    public String getContent() {
        return content;
    }

    public Command setContent(String content) {
        this.content = content;
        return this;
    }

    public List<CommandExecutor> getExecutors() {
        return executors;
    }

    public Command setExecutors(List<CommandExecutor> executors) {
        this.executors = executors;
        return this;
    }
    public void exec(){
        for (CommandExecutor executor:executors){
            executor.execute(content);
        }
    }
}
